package request

type CreateNovel struct {
	Name        string `form:"name" json:"name" binding:"required"`
	Author      string `form:"author" json:"author" binding:"required"`
	Cover       string `form:"cover" json:"cover"`
	Description string `form:"description" json:"description" binding:"required"`
}

// 自定义错误信息
func (c CreateNovel) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"name.required":        "书籍名称不能为空",
		"author.required":      "作者名称不能为空",
		"description.required": "书籍描述不能为空",
	}
}

type QueryNovel struct {
	Keyword string `form:"keyword" json:"keyword" binding:"required"`
}

func (q QueryNovel) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"keyword.required": "关键字不能为空",
	}
}

type GetNovel struct {
	NovelId string `form:"novel_id" json:"novel_id" binding:"required"`
}

func (getNovel GetNovel) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"book_id.required": "书籍id不能为空",
	}
}
